﻿using System;

namespace Wedn.Core.Entity
{
    /// <summary>
    /// 链接表实体拓展模型
    /// </summary>
    public class Link : IComparable<Link>
    {
        public int CompareTo(Link other)
        {
            if (this.order != other.Order)
            {
                return this.order.CompareTo(other.Order);
            }
            return this.id.CompareTo(other.Id);
        }
        #region 所有字段
        private int id;
        private string name;
        private string url = "javascript:;";
        //private string url = "javascript:void(0);";
        private string title;
        private string target = "_blank";
        private int type = 0;
        private bool visible = true;
        private int order;
        private int parentId = 0;
        #endregion

        #region 对外公共属性
        /// <summary>
        /// 主键(自增长)字段
        /// </summary>
        public int Id
        {
            get { return id; }
            set { id = value; }
        }
        /// <summary>
        /// 链接名称字段
        /// </summary>
        public string Name
        {
            get { return name; }
            set { name = value; }
        }
        /// <summary>
        /// 链接地址字段
        /// </summary>
        public string Url
        {
            get { return url; }
            set { url = value; }
        }
        /// <summary>
        /// 链接提示文字字段
        /// </summary>
        public string Title
        {
            get { return title; }
            set { title = value; }
        }
        /// <summary>
        /// 链接目标窗口字段
        /// </summary>
        public string Target
        {
            get { return target; }
            set { target = value; }
        }
        /// <summary>
        /// 链接用途字段(0:blogroll; 1:navigation; 2:footer)
        /// </summary>
        public int Type
        {
            get { return type; }
            set { type = value; }
        }
        /// <summary>
        /// 链接是否可见字段
        /// </summary>
        public bool Visible
        {
            get { return visible; }
            set { visible = value; }
        }
        /// <summary>
        /// 链接排序字段
        /// </summary>
        public int Order
        {
            get { return order; }
            set { order = value; }
        }
        /// <summary>
        /// 链接描述说明字段
        /// </summary>
        public int ParentId
        {
            get { return parentId; }
            set { parentId = value; }
        }
        #endregion

        #region 构造函数
        public Link() { }
        ///// <summary>
        ///// 链接表模型类构造函数
        ///// </summary>
        ///// <param name="id">主键ID</param>
        ///// <param name="name">链接名称</param>
        ///// <param name="url">链接地址</param>
        ///// <param name="title">链接提示文字</param>
        ///// <param name="target">链接目标窗口</param>
        ///// <param name="type">链接用途</param>
        ///// <param name="visible">链接是否可见</param>
        ///// <param name="order">链接排序</param>
        ///// <param name="parentid">链接描述说明</param>
        //public Link(int id, string name, string url, string title, string target, int type, bool visible, int order, int parentid)
        //{
        //    this.id = id;
        //    this.name = name;
        //    this.url = url;
        //    this.title = title;
        //    this.target = target;
        //    this.type = type;
        //    this.visible = visible;
        //    this.order = order;
        //    this.parentId = parentid;
        //}
        #endregion
    }
}
